import {
    createRouter,
    createWebHashHistory
} from 'vue-router'

import Admin from "~/layouts/admin.vue";
import NotFound from '~/pages/404.vue'
import Home from '~/pages/home/index.vue'
import Login from '~/pages/login/login.vue'
import Debugging from '~/pages/Debugging/index.vue'




// 默认路由，所有用户共享
export const routes = [
    {
        path: "/",
        name: "admin",
        component: Admin,
        // redirect: "/login",
        redirect: "/home",
        children: [
            {
                path: "/home",
                name: "home",
                component: Home,
                meta: {
                    title: '',
                    isBottom: true,
                    name: 'home',
                    keepAlive: false
                }
            },

        ]
    },
    {
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        redirect: "/home",
        component: NotFound
    },
    {
        path: "/debugsqfe34dsj",
        name: "Debugsqfe34dsj",
        component: Debugging,
        meta: {
            title: '监控调试',
        }
    }
]




export const router = createRouter({
    // history: createWebHashHistory('/tzl-app/'),
    history: createWebHashHistory(),
    routes,
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else {
            return { top: 0 }
        }
    }
})

